Implementing quick select.