Model rework

- introduced model-attribute state (changed) 
- some rework
- added more tests