Implemented quick sort