update and refactor api