refactoring and removed unused imports