optimize guard assets, functions and templates