Added arrayCheck function