Removed is valid token function
Fixed CSRF tokens doesn't match
Shortened the code