Added mod merging to the program.
Fixed bugs.