adding ability to flip mean sort