Switched to ternary operator for cleaner code