more work on refactoring