optimized kernel functions