this whole function is starting to be pretty long. Consider breaking it into two, moving map setup code into separate function