Mostly finished Quicksort, added a counting function