some minor code refactoring in mapController