Added a few simple function definitions
refactored the function names
added factorial and simplemerge
added a simpler version of prefixmin
refactored simplemerge