merge recursive functionality