a sprawling complex of buildings , the palace housed a grand-scale museum , a veritable labyrinth of institutional chambers , apartments , and courtyards , and a prison network so vast that it was housed in multiple buildings .