Refactor error pages