added the null checker and creation on one line