Make the code more readable by organizing elements of the function into sub-functions.
Make the code more readable by organizing elements of the function into sub-functions.