Extracted logic to helper