Refactored to rebuild test_db