Refactored YAML conversion functions.