Refactored the protocol library to use Futures.