Added sorting to list() method