Refactored map_path method