added testing code for error hadnling
isolated a full trace of where things go in here