get rid of unnecessary elements of the template