This is the way I do it for the sake of simplicity. Was trying to do it all in a triple nested loop but couldn't figure it out.