Refactoring, code cleaning, additional tests.