Refactor isArray & toString