Extraction of some logic into smaller methods