fix event parser
refactor code