refactor into a waterfall