add calculate new lines function