Improved multi line reference parsing