small simplification of priority function