Cleanup map code