Added more documentation to event and message, fixed a bug in query