refactor repartition