Some refactoring in the compiler for optimization.