error checking and validation