fix k->n
add some comments and details