partition implementation