abs chapter 14

I think it's not the best practice to be including other functionality in your sorting subroutine - this validation should have been separated out.