Added DI contract.
Refactored grammar element parsing