Refactoring to use model. At least compiles.