Group imports and remove unused imports