Refactor to separate data model from presentation/view code