Implemented thread priority and have the schedualer sort by priority