abstracted the parser using global variables