changed the '? :' syntax to if-else-then