refractor the google map code