added vanilla support (code from xunfin)