changed formating
added error function