Fixed bug, script now runs successfully

I think moving the declarations of the sample arrays out of the setup
loop and into the main loop fixed the issue. not quite sure why this is
but it worked.