Improving csrf implementation