Optimizations in formula script to improve performance on Insiel's case study. Merge with origin/development.