moved parsing to parser class

moved for and while loop body to their own methods

code clean up

more commenting