you could put this "updating the gmap" code in a function since it is used also above.