More tests and minor bug fixes.