Refactor variant and variant generator, more unit tests