Refactoring

Still needs to add the in/out processing, but the definition object has stubs for them.