change cookie implementation from client to server side