* Install the error handler early. * Include stack trace. * Remove unnecessary escaping. * Improve formatting. * Move to a separate script file.