support for model serialization

Deserialization still isn't quite there...