Add thrift-mode (closes #973)