Move template definitions to header