Refactoring Multi-format parser