Add type checking to array elements