- perplexity code added, (but not tested, need test)