some improvements and different kernel selection logic