Refactoring and add new protocol CWStateProtocol