applied coding convention and changed error printout to DEBUG(...)