Added runtime flag to choose K automatically.
Reader now uses pointers instead of references for consistency.
K is now chosen automatically based on data with --auto flag.
Minor cosmetic code changes.