Style fixes.
Fixed config validation bug; simplified code.
- Includes tests.
Expanded tests.