Template and index cleanup