apparently array.clear() doesn't exist; setting length to 0 instead