Moved code from Torque to ThriftDB