Updated script handler