Remove unused code and fix typos