Wrapped all scripts in required 'check' function, fixed scope issues, resolved complexity limits in complete script, and added comprehensive tests.
Wrapped all scripts in required 'check' function, fixed scope issues, resolved complexity limits in complete script, and added comprehensive tests.