after refactor to functions