added trim to the right place
initialization of check of user input