Optimized a bit, removed multiple calls