Fixed odd error (due to a bad array elem deletion). Use splice next time to delete items from arrays. Only then does the length of the array reset.