Thrift integration

Replacing RPC layer with Thrift.