Use better api methods

setContents() and runTask()
Merge pull request #1 from riking/patch-1

Use better api methods