correcting content and pruning the template