Throw Errors instead of strings. Add 'grunt test' task. Fix a couple of JSLint issues