Refactoring of Variable sampling. Should work now when variable is used multiple times within the same factor.