finished refactoring the keystone states.
Merge branch 'dev-keystone' into develop