Api refactor