STYLE: Fix static analysis-related issues and reduce number of includes

This is using a commercial static analysis tool called Includator.