Make user-agent a constant at the top. Also add CSRF token support.