refactored to internal modules to attempt to get this working.