Minor code quality improvement

Use case instead of if