Refined debugging output and headers