smart controller for loading in templates