Some cleaning up in the code. I tided the objects a bit. Enhanced the caching to include individual layers and switched the total map size to be fetched from the server, when static layers are generated. Now the data is in one place (at server), which is better.