Optimize using unsafe.