Removing erroneous lines