refactor helper methods