removed unused imports and refactor