Sf optimization

I've been working on SF optimizations, this is the first of 2 pulls I'm going to send you. These changes take about 10 seconds off running ant format-source