Updated main script.