Refactoring classes' dependencies