Refactoring and removing unused dependencies