Refactored database schema