How did the victories and defeats in battles affect the Union and Confederates' goals in the Civil
War?