Refactor to extract helper