Modified code for pos with QUAL=INFINITY