use strategy pattern
Refactoring parser to use strategy pattern.