Updated sort, cleanup