moved template, for straightforward compilation