clean up unused imports, add logging, rid of dead code