move some code into Smarty_Internal_Debug class
  where it better belongs to