error checking and improvements in messaging