The update function performs four distinct steps which can readily be broken down into four separate functions.