modified to put header in the result output