Modify sorting function, add ascending order