refactor csrf

using csrf wrapper function
I have not tested this yet, but its a pretty straight forward swap.