Re #8487. It seems that Windows wants this include.
Re #8487. Put include in right place to make Windows happy.

Also clear up a few unused headers.