autosort logic for list