More code optimizations