Better template handling