Amended script to use non-conflicting ready handler