Refactored a few API accessors.
Merge pull request #435 from namusyaka/refactor-some-codes

Refactored a few API accessors.