refactoring to FormatParser