Deletes unsed references and comments