Mostly done. Now to hook in debug on error.