copied from factual/eliza