more code optimizations