added parser class

and some refactoring