adds trigram support. Currently bugged due to possible cycles