abstracted out a "function" in parser