fix size bug when k < 31
clarify use of stdin
more updates