simple kt algorithm now implemented though not working correctly