Added the ability to get locations from the server.
minor refactor and tidy up.