more error checking and messages