Improve coverage. Add tests for DB. init_db is now idempotent