refactor  API