pseudo code for event handlers