My sorting functions are now pretty respectable.