ISSUE#5: Refactored parse_metadata into smaller functions