encapsulated map code