Merge pull request #12 from mewpull/master

Update API to use stricter type checks.
Stricter type checks. Add ErrorCode type.