array function with data storage working