remove unused code and add missing use statements
fix uninitialized variable