refactoring to split the api from the module