Add Brackets to foreach
Remove unnecessary ternary operator.