Smarty 3 support added - rewrote mode