added ability to take elements from an array