Remove unused references and tune logging