refactored flow to better support implicit grant edge cases