Refactoring and remove unused imports