A better implementation of bucket-split

Thank you, Vedang Manerikar for the first-cut of this function