Edits to the upload to database function