First pass at partitioning functioning
Folding structure in place
Renamed partition to fold and fixed min/max confusion in length_data