Split into smaller functions.