Added better variable name generation to prevent collisions