second part of the refactoring and updates