worked on templates failed sin wave function!