Many updates

Moved implementation to .h file, added templates for long, floats and
doubles.