all tests pass, refactor with partition