reworked the the exercise to echo results through a foreach loop
which is mush shorter and less code written