Added methods to make sortList function