Some refactoring to get the bounds of the map on the client