Fixing the -k option to store more of the data
fixed some issues, added some options; still need to work on debugging