more work refactoring flow