Moved the database updates earlier in the process.