Added in promise-based API. Closes #7.