refactoring api structure