Optimization, with speed test.