Cleaning up the code for the priority algorithm in the outbound flow
controller