changed the output format in reverse order