added dealing function