added sorting stuff