Using setKernel and addKernel functions wherever it was possible to boost the performance