Added loop and outputs for the two arrays.