Fix unused imports
Remove unused variables
Add test case for constructor method
Merge branch 'hotfix/#6093-dead-code-cleanups'

Close #6093