Start to parse log events
Some code cleanup and some event handling code