Refactor 3-quick sort