Reorder event handlers and related functions in app.ts.