Updated type casting for array function