Refactored into hpp+cpp

Moved the non-templates functionality from the header and into a proper
.cpp file.

Fixed a problem with the makefile.