added recursive function
merge