General refactoring and bugfixes

Tidied up includes, added exception for include giving compiler warnings

Refs #9968