Refactored database model