Moved parser creation to function