refact API