Implemented a simple scripting system
Added a few guards