Clean up debug code, remove dead code