Improved parser and output fixes

Better parser should now be able to handle multiline statements and
outputs should no longer duplicate
Merged error fixes