Added flag to only print last line