Start refactor to support multiple protocols.