Restructured models and database connections