Cleanup.
Improve attribute checks.
Add tests.
Update version.