Replaced the ternary operator for a if else statement