moved database initialization and updating into new file