corrected spelling of at and converted if else to a ternary operator