Move template code to a better location and denote it in the comments.