Fixed "script failed" messages

Introduced a lot of debug "print" messages to figure out what's going on with your code.  Not expecting you to fully merge this, but take a look at what I've done, because I've gotten it to work on a basic level.