refactoring api to hide some functions