formatting and extra error logging