Smarty refactoring