Reorganised script dependencies, to enable running from the web.