refactoring parser functions