implement partition
implement partitionBy
merge partition & fix conflicts
small bit of code cleanup