Use generic comparer
Remove ArrayList dependency