Added error flagging