refactor api structure