Cleaned up map code