Partition by gc now works, changed the whole alg