Moved code from header to source file to avoid duplicates since it's not
templated
Fixed missing include