Performance improvements, based on profiling
isArray uses Array.isArray if available