Initial stab at untangling the #include maze. Probably needs a second pass.