Refactoring; mostly reformatting.
Simplified code.