Reformat & optimize imports.

Just to reduce random noise when it does parts of this automatically as I change other things.
Fix a bunch of analysis issues.
Refactor some of the sorting code to new methods.
Vector -> ArrayList