sorting by priority now works