Fixed some bugs that appeared with the last commit. Added more info on the event functions documentation.