Remove dead code and fix lint errors