Added database configuration
Refactored environment and fleshed out models.