Added optional validation.

Fixes #11