Refactor the large method into smaller ones.