replacing linked list with standard array