Fixed errors for Microsoft compilers
Rearranging some things

The class static member functions didn't need to be inside the
class template.