Implement sort by priority and date