refactor partitions api