check sorted function added
it will sort things while self timing!