refacroring and 1 new tests