implemented proper random event handling