states refactor complete