Changed read arrays logic