Separate implementation of template functions in Miscellaneous.h

Fixes #45.