further cleaning up of waterfall code