check key and value together; more informative output; add comment