added array version