histogram kernel updated + code refractoring