refactor to work with latest api
Merge pull request #1 from dbones/master

refactor to work with latest api