implemented the up & down sorters