Refactored model to be object-oriented.