Added InsertionSort and tidied up some of the code.