added some debugging messages to inform me of where it encounters the error more prescicely (sp?)