Cleaner template control
Minor fixes