Debugged for-statement in parser, was not detecting end, added changes to while-statement as well.