Some error checking and messages.