refactor with change in public and private methods