Added comment and changed ternary operator