function refund() public {
    require(msg.sender != winner, "winner cannot refund");
    require(bids[msg.sender] > 0, "refunds only allowed if you sent something");

    uint refundValue = bids[msg.sender];
    bids[msg.sender] = 0; 
    msg.sender.transfer(refundValue);
    
    emit Refund(msg.sender, refundValue, now);
  }