Event stuff added

Please review code for DB stuff