works with array