cleaned up map code