changed flag used from first -> precendence