Refactored tiled map functions into Map module.