refactoring the API to be more beautiful