working version of find_basin