added models and database functionality