refactoring the api...