Tests and changes to boost coverage and correct specs.

Most tests are there to ensure the external api remains consistent and
cover the interesting cases. This has boosted coverage from 60's to 90's.
This also caught incorrect specs for some return values.