Added error messaging and clearing the form