move all partitioning stuff under condition