Merged with trond's header file cleanup branch.