Optimizations, removing useless temp values