phone state refactor