messing around with comments and formating
lots of clean up, main argument to kmatch should be x, not data. Requires lots of changes elsewhere. Still having a problem with one test.