Added validation,a generic function to display error messages and rephrased error messages