avoiding-non-null-assertions

Avoid non-null assertion operator (!) and use type-safe alternatives instead