Refactor manager_api