Added needed math_fwd.hpp includes were needed, cleaned up code, and generally got things compiling with gcc.