initial merge code
updated merging