Added more optimizations