Added unit test and fixed bugs. Added ability to specify a dictionary for minpad.
Fix remaining test failures