split into smaller methods