Rewrite ugly if-else one-liners as ternary operator
Fix Scrutinizer errors