refactor
add state load/save
Merge branch 'master' into dev
tests are all passed now