Added input and test/example for user input and included null checks for it