Extracted logic into a new class