Updated script to match the latest document