Added a test for watershed and updated a few functions