Move code to be a submit handler.