This code is more elegant

output has not changed