Change how priority is calculated to not get priority < 1 or > 16