Refactored error page handling, minor style changes