Remove ternary expressions

A more readable and scalable approach
Merge pull request #636 from glebm/patch-1

Remove ternary expressions