k-path algorithm now works