refactoring and update of unit tests