Improve upgrade script, etc