Use when instead of if for one case conditional