refactor on api