Refactoring thrift