Removing references to unused items