Switch to using functions, working variable generation.