Refactored database package