better error logging I think