Added error message functionality