some logic and styles fixes. Saving model state when model version was changed.