moved database initialization