Added an error mechanism.  Fixed endless loop when dealing with an invalid entry