improved sorted