Remove dead code. Improve headers and formatting.