allow ref to go on two lines
structured parsing setup and ref line finding
moved ref line scanning to extra method