Notes on writing a model