Finished the reading function and started the sort function.