ArrayUtil cleanup and minor refactoring.
Cleanup several warnings, some refactoring.