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