Code efficiency improvements