refactor to use a function