Remove unused references and cleaned code