Add sort function (Task3) (WIP)