fixing the priority algorithm to comply with the semantic: posl, type, affinity has higher priority over shallowness