Refactored the map controller into mapgenerator and locationrepository