Moved models and db into separate libs