Add patches and first version of partitioning script