Did some optimizations