major rewrite for coupled partitioning