added priority calculations