remove comment
improved readability
refactor statefactory and clean up