Sorry, for now, your best bet is probably to look at the source code of a model which is close to what you want to do.