add debug printout and support for new format structure