Make minimap toggleable and minor code refactoring