refactoring: do not duplicate code path, partition list instead