Refactor load_mapping() to move line parsing to inner function