refatored array recursion to one liner