adds waterfall function