Need some help with a custom template (coding errors)