refactor HOF