refactor to public api