this next code has a streamlined way of doing the same