Fixed a few crashes, methinks.
Wow, I'm a fail.
Caught the end of script.
Added signal and debugging stuff.