added ERROR detection -- does not currently work