numerous branching stmts converted to ternary