Adding error management