Updated to version 4.2.

Cleaned up script framework. Added failsafes.