Optimization and more tests/benchmarks.