Add DB indexes and fix more tests