Added even better error management