added docstrings; checked type for array-like