some light refactoring

We still need to firm this up a little more before switching to stored procedures that do roughly the same thing and having the map access a cached site/app map instead. Will incorporate redis option for cache persisting here soon