use iterative partitioning instead of the minimum optimization

makes code a lot simpler and even a bit faster