Added ternary operator and for loops