Major overhaul of the script