removed unnecessary print statements & introduced an outfile option to manually save the reordered and sorted array