refactoring API code
Merge pull request #16 from destos/api-refactor

refactoring API code