Some code fix for merge and renaming of some variables.