Thank you both for the additional code!

Can someone clarify where exactly it needs to be inserted? I am not sure how to apply it.