refactor variant , add test