Mostly just wrote partitioning algorithm

Partitioning algorithm still does not work, but it is getting there