Refactored database scope