Added sort, small changes