add validate() function, fixes #7

Teensy nit: we've been using `camelCase` variables rather than underscores.