Fix errors and refactoring parsers