Added a sort. Added a print function to test sorting was working as intended.