updated output with correct format and number of lines