Better isArray implementation