refactored API in UI