Smoothing elements except for end points.
Completed question 3.