more work on flow implementation