New test cases. Some more optimizations.