refactor waterfall