refactored some apis