add input validation

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
Merge pull request #35 from battlemidget/patch-input-validation

Patch input validation