added kessels algorithm