Use Array.isArray is simplify code a bit