Refactoring variable factory.