thanks for the suggestions! Now that I have a working piece of code, I can build on this and make the improvements as per your post.
I will start with the arrays and then continue with the simplified functions.
It helps that the code now works so troubleshooting is easier since I can focus on the arrays only and continue from there.