modified flow slightly