Refactored & reimplemented the scripting system.