more work on refactor