Add initial version of the partitioning function