add write to model file, haven finished write hashmaps