Better assembly of output file