Updating script to v2.4

Cleanups and error checking.