Initial code for before trigger.