simplify the method delete

combine the logic to simplify the adding of the next line