New version of script with upload of database