refactored the helper into a smaller piece