Bug fixes and refinement of ScriptWrap!