More tests and refinements.