Implementing additional sorting methods, and reducing code duplication.