enhanced merge functionallity