Cleanup template formatting