Refactor API functions
Merge pull request #4 from dyba/Refactor-API-functions

Refactor API functions