Removes unwanted references