Extract show_first_lines method