Removed templated code from cpp, put into header