add sorting functions