added factorial and simplemerge