Refactoring: removing $smarty global variable