Formatting and error handling in example2