Split logic to separate components