Smarty, fixes and modifications