Updated code for #1 issue  2. error and all warnings and suggestions apply