more work on the large refactor and cleanup