dekash changed to func & reduced num of variables