separated parsing code into parser module