refactoring: introducing parse_with_type and parse_with_name helper functions