use ?. operator to simplify method