got partitioning working

ultimately made sense but kind of a mess with sorting