Refactored CSRF class