Update API implementation and some bug fixes.
Merge pull request #9 from Sharparam/master

Update API implementation and some bug fixes.