adding tests for scripting parser, improving some code and fixing some bugs in the process