CLeanup if/elsif to case/when statements