code style improvements, updates mergeMaps with type check instead of instanceof

UTs verifed