code cleaning and two tests added