Adding hooks for custom field types and reorganizing field code