Code added to the two functions