use floats for K and make sure D is filled