Refactoring, introducing states for the behaviors