Cleaned up some map code for closure.