Implemented setting for sortorder in main and history views