Refactor mapdata