Main scripting