refactoring of the helper