Cleaned up tests a bit. Added some docs in multiple places.