better algorithm for map offset