Header cleanup

Fixes #1787

Code review please