extracted method for removing the previous line