improved format and error management