Refactored sanitization

To ensure we catch non-theme error pages.

Removed unnecessary commented code lines.