Solution for merged variables