fixed some more bugs caused by refactoring and implemented some of the model classes along the way.