refactor state generation