Added parser class, improved structure of code