Everything works now thanks to the new loop. I've also added the output