generates correct output format