Improved tests. Cleanup.