Updated sorting to be contained in method