Fixing issue where the array was retaining previous values.