rename variable consistently in merged function