Refactored models to use database singleton