Prepare event handler for the compare button