added the sort function again based on size