Tweaking template code