Added some more tests and comments to the source