refactor to two steps