Improved validation messages.
Massive code reorganization.
More tests.