Fixing the database layout