Refactored database model to use join tables instead of manual population