update case statements to use when instead of :