refactor helper