second commit: added the sorting code to main file