switched to models and added database tables