Refactoring of unit tests and correction of some errors