Add template and use template

Next step is to complete function
lalalal

lalla