Removed useless code and add newlines to error messages