implement partition