Debug code separated to util.h. Cosmetic fixes.