Bug fixing.
Added first undefined heuristic and a class for managing error messages.