small refactor in parsing