Added nullability checks