refactored teh error function... and also continued the debugging efforts

DEbugged to the erorr network…