A bit of profiling helped get a few % off