code cleaning; tests improvement;

more detailed tests