Write model and view framework code