I am open to suggestions as to a better place to place the functionality of this for-loop in.