Refactor into helper