Improvements in key checking

Numerous bug fixes and output  info/formatting changes