Added the code for parsing events