refactored map code
Merge branch 'master' into angular