factored out code from the water bucket node callback