Refactoring, try to fix grid calculation, but does not work yet for higher zoomlevels