Added sort by priority