allow access to map via @map
extracting buildmap functionality into its own method