refactor to public and package level methods