Refactor/api