added giveup function and event log