Updated to current version 0.5.1

Added some test classes, and changed the rest to keep a more consistent
testing. This ought to be the last version to be uploaded. It probably
won't be needed, but I update it anyway in case our client wishes to see
the new code afterwards.