Fixed the api after refactoring