Clean up code style.

PSR-2, some docblocking, and a tiny bit of extract refactoring.