Working code for 'waterfall'.