second try

Second try with template (first try didn't work)