Fixed the issues

Used Lists for the dynamic array, which let me use the Distinct() method
to separate out the distinct values.