Refactoring.

* Reformat things.
* Use generics for various collections.