Cleaned up Model class. Moved chunks of code into their own member functions.