Speed optimizing CPU version