-- refactored to allow field definitions to be defined and parsed