fairly large refactor plus add a UniqueArray