start refactor to with recursive