Updated map code to use new api query + cleaned up a bit