refactor user state