added single core optimized implementation