refactoring: move parsing function into another file in order to reuse it.