improve and refactor debug interface, cleanup headers