optimized condition, a ternary is enough here
Also fixed a variable name case