Adding a layer model

This contains some unmerged branches from @zachmullen.  The relevant changes are at the end.  Next I will connect the model to the pipeline view.