Updated adaptive kernel routine