a few improvements
Optimizations from Proj. 4