Finalised the parser and refactored the code.
error handiling for the parser implimented