huge rewrite, split to base and yandex-specific parts

hm, I could safely replace it with frozenset, I think