refactored common parser code into an abstract class