updated entire script