major refactor of gmap