Further optimize MiscSorter and fix the test script to actually run