refactored a bit
added separate model, not used yet.
prepared serialization of the model.