Perf optimizations. Most commented due to lack of internet
Perf optimizations