This function is broken into two primary elements: