KIHAM algorithm