thrift refactoring