Compiler Optimizations

Credit to pbeeler.

Change-Id: Ic83285f8ea541d19e85634553f8fc41956e4d3f2