refactor google map code