move common expression out of "case"