Database initialization task +refactoring