priority_order function

Trying to write a code for priority_order. Could separate them into
separate functions. Getting the message “function is not used”