cleanup unused headers, set internal linkage for non-exported bits