Moved the detection of on-disk arrays out of the main loop