refactoring api complete