parsing functions refactoring