dh/major refactoring

This series of patches affects most of the codebase. Many files have been moved around and/or touched in order to provide a more consistent directory structure and improved header inclusion. This will affect all platforms, although any enforced changes should be straightforward to resolve.