implemented template body with function